package com.huang.PC.pcDemo;

import java.util.List;

public class cDemo implements Runnable{

    private List<String> list;
    public cDemo(List<String> list) {
        this.list = list;
    }
    @Override
    public void run() {

            synchronized (list){
                while (list.size()==0){
                    try {
                        list.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                list.remove(0);
                System.out.println("消费了一个"+Thread.currentThread().getName());
                list.notifyAll();
            }
        }


}
